import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from 'views/Home'
import Friends from 'views/Friends'
import Cart from 'views/Cart'
import Search from 'views/Search'
import NewsList from 'views/Home/news/NewsList'
import NewsInfo from 'views/Home/news/NewsInfo'
import PicList from 'views/Home/pictures/PicList'
import PicDetail from 'views/Home/pictures/PicDetail'
import GoodsList from 'views/Home/goods/GoodsList'
import GoodsInfo from 'views/Home/goods/GoodsInfo'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    meta: {
      title: '首页',
      tabShow: true,
      active: 0,
      keepAlive: true
    }
  },
  {
    path: '/friends',
    component: Friends,
    meta: {
      title: '朋友列表',
      tabShow: true,
      active: 1,
      keepAlive: true
    }
  },
  {
    path: '/cart',
    component: Cart,
    meta: {
      title: '购物车',
      tabShow: true,
      active: 2,
      keepAlive: true
    }
  },
  {
    path: '/search',
    component: Search,
    meta: {
      title: '索引',
      tabShow: true,
      active: 3,
      keepAlive: true
    }
  },
  {
    path: '/home/newslist',
    component: NewsList,
    meta: {
      title: '新闻列表',
      tabShow: false,
      active: 0,
      keepAlive: true
    }
  },
  {
    path: '/home/newsinfo/:newsId',
    component: NewsInfo,
    meta: {
      title: '新闻详情',
      tabShow: false,
      active: 0,
      keepAlive: false
    },
    props: true
  },
  {
    path: '/home/photolist',
    component: PicList,
    meta: {
      title: '图片列表',
      tabShow: false,
      active: 0,
      keepAlive: true
    }
  },
  {
    path: '/home/photoinfo/:photoId',
    component: PicDetail,
    props: true,
    meta: {
      title: '图片详情',
      tabShow: false,
      active: 0,
      keepAlive: false
    }
  },
  {
    path: '/home/goodslist',
    component: GoodsList,
    meta: {
      title: '商品列表',
      tabShow: true,
      active: 0,
      keepAlive: true
    }
  },
  {
    path: '/home/goodsinfo/:goodsId',
    component: GoodsInfo,
    props: true,
    meta: {
      title: '商品详情',
      tabShow: true,
      active: 0,
      keepAlive: false
    }
  }
]

const router = new VueRouter({
  routes
})

export default router
